#include "helper.h"

namespace Opl{
    namespace Gui {
        namespace Helpers {

            QPixmap colorize(const QPixmap &source, const QColor &color)
            {
                QImage temp(source.size(), QImage::Format_ARGB32_Premultiplied);

                temp.fill(0x0);
                QPainter p(&temp);
                p.drawPixmap(0, 0, source);
                p.setCompositionMode(QPainter::CompositionMode_SourceIn);
                p.fillRect(temp.rect(), color);
                p.end();

                return QPixmap::fromImage(temp);
            }

        };
    };
};
